import { Nodes } from '@knno/dom';
import { NavigatorEventMap, Navigator as UINavigator } from '../components/navigator/navigator';
import { JSXProps } from '@knno/dom/jsx';
import { AttrCheck, On, isBool, jsxBuild } from './utils';

export { UINavigator };

interface NavigatorProps extends JSXProps<UINavigator>, On<NavigatorEventMap, UINavigator> {
	retainLastPage?: boolean;
}

const ATTRS: AttrCheck = {
	retainLastPage: isBool,
};

export function Navigator(props: NavigatorProps, children: Nodes[]): UINavigator {
	return jsxBuild(new UINavigator(), props, children, ATTRS);
}
